<%= form_for(User.new.with_profile, :as => "user", :url => registration_path(User)) do |f| %>

  <div><%= f.label :email %><br />
  <%= f.email_field :email %></div>

  <div><%= f.label :password %><br />
  <%= f.password_field :password %></div>

  <div><%= f.label :password_confirmation %><br />
  <%= f.password_field :password_confirmation %></div>

<%= f.fields_for :profile do |profile| %>
  <div>
    <%= profile.label :name %> <br />
    <%= profile.text_field :name %>
  </div>
  <div>
    <%= profile.label :surname %> <br />
    <%= profile.text_field :surname %>
  </div>  
  <div>
    <%= profile.label :phone %> <br />
    <%= profile.text_field :phone %>
  </div> 
  <div>
    <%= profile.label :faculty %><br />
    <%= profile.select :faculty, "" %>
    </select>
  </div>
  <div id="groups-list" class="hide">
    <%= profile.label :group %><br />
    <%= profile.select :group, "<option value=0>Select group</option>" %>
    </select>
  </div>
<% end %>

  <div><%= f.submit "Sign up" %></div>
<% end %>